package sing.core.ext.view

import android.widget.SeekBar

fun SeekBar.onProgressChanged(onProgressChanged: (Int) -> Unit,onStopTrackingTouch: (SeekBar?) -> Unit) {

    this.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {

        override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
            onProgressChanged.invoke(progress)
        }

        override fun onStartTrackingTouch(seekBar: SeekBar?) {
        }

        override fun onStopTrackingTouch(seekBar: SeekBar?) {
            onStopTrackingTouch.invoke(seekBar)
        }
    })
}

